<?php

class Partic extends CI_Controller {

/**
 * @author Меркулов Илья aka Bit0reZ
 * @license GNU GPLv3
 */

        var $data;
        
	function __construct()
        {
                parent::__construct();
                $this->load->model('Check', 'check');
                $this->load->library('pagination');
                $this->load->library('Parser');
                $this->load->helper('url');
                $this->data['base_url'] = base_url();
	}

	function index()
	{              
                
        }

        function lspar($from = 0)
	{
                $this->load->library('Pagination');
                $config['base_url'] = 'http://example.com/index.php/test/page/';
                $config['uri_segment'] = 3;
                $config['total_rows'] = '200';
                $config['per_page'] = '15';
                $config['num_links'] = 2;

                $uri = $this->uri->uri_to_assoc(3);
                switch (key($uri))
                {
                        case 'inst':
                                $this->data['data'] = $this->check->getVVSUInsts();
                                $this->data['nlink'] = 'kafs';
                                break;
                        case 'kafs':
                                $this->data['data'] = $this->check->getVVSUKafs($uri['kafs']);
                                $this->data['nlink'] = 'grps';
                                break;
                        case 'grps':
                                $data = $this->check->getVVSUGroups($uri['grps']);
                                if($data['count'] > 15) echo $data['count'];
                                unset ($data['count']);
                                $this->data['data'] = $data;
                                $this->data['nlink'] = 'stds';
                                break;
                        case 'stds':
                                $this->data['data'] = $this->check->getVVSUStuds($uri['stds']);
                                $this->data['nlink'] = '';
                                break;
                        default:
                                $this->data['data'] = $this->check->getVVSUInsts();
                                $this->data['nlink'] = 'kafs';
                                break;
                }
                $this->pagination->initialize($config);
                $this->data['links'] = $this->pagination->create_links();
                $this->parser->parse('gadgets/participants', $this->data);
        }
}
